package chuishop.yiqimaicai.service.Impl;

import chuishop.yiqimaicai.mapper.BusinessDetailsMapper;
import chuishop.yiqimaicai.pojo.BusinessDetails;
import chuishop.yiqimaicai.service.BusinessDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessDetailsServiceImpl implements BusinessDetailsService {

    @Autowired
    private BusinessDetailsMapper businessDetailsMapper;

    @Override
    public List<BusinessDetails> findAllBusinessDetails() {
        return businessDetailsMapper.findAllBusinessDetails();
    }

    @Override
    public List<BusinessDetails> findDetailsById(Integer gid, Integer sid, Integer gsid) {
        return businessDetailsMapper.findDetailsById(gid,sid,gsid);
    }

    @Override
    public List<BusinessDetails> findDetailsByGid(Integer gid) {
        return businessDetailsMapper.findDetailsByGid(gid);
    }

    @Override
    public List<BusinessDetails> findDetailsBySid(Integer sid) {
        return businessDetailsMapper.findDetailsBySid(sid);
    }

    @Override
    public List<BusinessDetails> findDetailsByGsid(Integer gsid) {
        return businessDetailsMapper.findDetailsByGsid(gsid);
    }

    @Override
    public List<BusinessDetails> findDetailsByGidAndSid(Integer gid, Integer sid) {
        return businessDetailsMapper.findDetailsByGidAndSid(gid,sid);
    }

    @Override
    public List<BusinessDetails> findDetailsByGidAndGsid(Integer gid, Integer gsid) {
        return businessDetailsMapper.findDetailsByGidAndGsid(gid, gsid);
    }

    @Override
    public List<BusinessDetails> findDetailsBySidAndGsid(Integer sid, Integer gsid) {
        return businessDetailsMapper.findDetailsBySidAndGsid(sid, gsid);
    }

    //删除功能
    @Override
    public boolean delBusinessDetails(String[] ids) {
        if(businessDetailsMapper.delBusinessDetails(ids)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean addBusinessDetails(BusinessDetails businessDetails) {
        if(businessDetailsMapper.addBusinessDetails(businessDetails)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateBusinessDetails(BusinessDetails businessDetails) {
        if(businessDetailsMapper.updateBusinessDetails(businessDetails)>0){
            return true;
        }
        return false;
    }
}
